Skip to content

Fix recipe loading when fmf tree is not present#4807

Merged
happz merged 9 commits intomainfrom
fvagner-recipe-fixes
Apr 22, 2026
Merged

Fix recipe loading when fmf tree is not present#4807
happz merged 9 commits intomainfrom
fvagner-recipe-fixes

Conversation

@therazix
Copy link
Copy Markdown
Contributor

@therazix therazix commented Apr 20, 2026

Recipe loading now works even when the current working directory does not contain an fmf tree, by creating a new tree from the saved fmf root path.

Pull Request Checklist

  • implement the feature

@therazix therazix added ci | full test Pull request is ready for the full test execution area | recipe Related to the tmt recipe handling labels Apr 20, 2026
@therazix therazix requested a review from 4N0body5 as a code owner April 20, 2026 09:24
@github-project-automation github-project-automation Bot moved this to backlog in planning Apr 20, 2026
@therazix therazix force-pushed the fvagner-recipe-fixes branch from 7f66223 to ac92ce2 Compare April 20, 2026 09:25
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request transitions the recipe system to use absolute paths for results and refactors the RecipeManager to handle fmf tree creation internally. It also adds custom serialization for ReportPortal report data to ensure correct formatting of log limits and patterns. A suggestion was made to remove a redundant tree check in tmt/base/core.py to support recipe loading in standalone environments where a tree might not yet exist.

Comment thread tmt/base/core.py Outdated
@therazix therazix added the status | blocking other work An important pull request, blocking other pull requests or issues label Apr 20, 2026
@therazix therazix moved this from backlog to review in planning Apr 20, 2026
@psss psss added this to the 1.72 milestone Apr 20, 2026
@tcornell-bus tcornell-bus self-assigned this Apr 20, 2026
Comment thread tmt/recipe.py Outdated
Comment thread spec/recipe.fmf Outdated
@tcornell-bus
Copy link
Copy Markdown
Contributor

tcornell-bus commented Apr 20, 2026

I tried to verify the fix by doing a basic tmt run via container.

Then I moved into a blank directory with no fmf tree and tried to run with the recipe file:
(tmt version: 1.71.0)

tcornell ~/tmp $ tmt run -vvv --recipe /var/tmp/tmt/run-063/recipe.yaml

No metadata found in the '.' directory. Use 'tmt init' to get started.

The exception was caused by 1 earlier exceptions

Cause number 1:

    Unable to find tree root for '/home/tcornell/tmp'.

(PR)

(dev) tcornell ~/tmp $  tmt run -vvv --recipe /var/tmp/tmt/run-063/recipe.yaml

[...]

    execute
        queued execute tasks
            #1: default-0 on default-0
        
        execute task #1: default-0 on default-0
        how: tmt
        order: 50
        ignore-duration: false
        exit-first: false
            test: Concise summary describing what the test does
                duration deadline: 300 seconds, at 16:23:03 2026-04-20 UTC
                cmd: ./test.sh
                stdout: ./tmt-test-wrapper-inner.sh-smoke-1-default-0-default-0: line 1: ./test.sh: No such file or directory
                00:00:00 errr /smoke (on default-0) [1/1]
                    Note: beakerlib: TestResults FileError

    
        summary: 1 test executed

Looks like it made the fake tree, but the tree does not have the supporting test files.
When I execute the same command in the original fmf root directory, it runs fine.

Am I reproducing this correctly?

Comment thread tmt/steps/report/reportportal.py
@therazix therazix changed the title Fix recipe generation and loading Fix recipe loading when fmf tree is not present Apr 21, 2026
@therazix therazix removed the status | blocking other work An important pull request, blocking other pull requests or issues label Apr 21, 2026
@therazix
Copy link
Copy Markdown
Contributor Author

Looks like it made the fake tree, but the tree does not have the supporting test files. When I execute the same command in the original fmf root directory, it runs fine.

Am I reproducing this correctly?

Yes, I would say that is expected. When users move the recipe or execute it from a different location, they should handle the necessary test files. Either move them to the new directory or rewrite the recipe with updated paths.

@tcornell-bus
Copy link
Copy Markdown
Contributor

I think I am misunderstanding the use case. What situations would a user execute the tmt command outside of the fmf tree? Could you provide an example or add a test case, please?

@therazix
Copy link
Copy Markdown
Contributor Author

I think I am misunderstanding the use case. What situations would a user execute the tmt command outside of the fmf tree? Could you provide an example or add a test case, please?

In some cases, an fmf tree is not needed when the run is loaded from the recipe, unless the test requires some additional files. I ran into this while creating a script for re-executing tests. tmt would raise an exception due to a missing tree, even though we wouldn't need it.

But looking at it again, I completely missed that we actually save the fmf root path in the recipe, so we can just set it from there, and that would solve the issue. Changed in f2512fc.

@LecrisUT
Copy link
Copy Markdown
Member

But looking at it again, I completely missed that we actually save the fmf root path in the recipe, so we can just set it from there, and that would solve the issue. Changed in f2512fc.

👍 to the idea, but can you double check that the tree in there is the user tree and not the work tree. If it is the latter, then it should be changed to the former imo.

What situations would a user execute the tmt command outside of the fmf tree?

Not exactly the original context, but a situation that should probably be supported (or disallowed explicitly) is if one runs tmt run ... without a fmf root at all.

@therazix
Copy link
Copy Markdown
Contributor Author

👍 to the idea, but can you double check that the tree in there is the user tree and not the work tree. If it is the latter, then it should be changed to the former imo.

It is a user tree, e.g. /home/user/tmt-plans

Comment thread tmt/recipe.py Outdated
Copy link
Copy Markdown
Member

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from me, but I deffer to @tcornell-bus discussion on handling the case with no fmf trees

Copy link
Copy Markdown
Contributor

@tcornell-bus tcornell-bus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now.
In an empty tmp dir with no fmf tree:
Old:

tcornell ~/tmp $  tmt run -vvv --recipe /var/tmp/tmt/run-063/recipe.yaml

No metadata found in the '.' directory. Use 'tmt init' to get started.

The exception was caused by 1 earlier exceptions

Cause number 1:

    Unable to find tree root for '/home/tcornell/tmp'.

PR:

(dev) tcornell ~/tmp $ tmt run -vvv --recipe /var/tmp/tmt/run-063/recipe.yaml
/var/tmp/tmt/run-095
[...]
Found 1 plan.

/plans/all
summary: Run all tests
    discover
        directory: /home/tcornell/tmt_testing
        how: fmf
        order: 50
        summary: 1 test selected
            /smoke
            
 [....]
 total: 1 test passed

It found the original fmf tree and successfully executed.

@happz happz moved this from review to merge in planning Apr 22, 2026
@happz happz force-pushed the fvagner-recipe-fixes branch from 4d08082 to e43419c Compare April 22, 2026 16:06
@happz
Copy link
Copy Markdown
Contributor

happz commented Apr 22, 2026

freedesktop.org is down, hence the linkcheck fail. The rest is green, merging.

@happz happz merged commit f309570 into main Apr 22, 2026
49 of 57 checks passed
@happz happz deleted the fvagner-recipe-fixes branch April 22, 2026 18:09
@github-project-automation github-project-automation Bot moved this from merge to done in planning Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area | recipe Related to the tmt recipe handling ci | full test Pull request is ready for the full test execution

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

5 participants